#pragma once
#include "CarSimDefs.h"

class RangeFinderArray
{
	Pos2d * m_arrRangeFinderPositions;
	Pos2d * m_arrRangeFinderDirections;

	Pos2d * m_arrXformedPos;
	Pos2d * m_arrXformedDir;

	double * m_arrLfRanges;
	int m_nNumRangeFinders;
	int m_nNumRangeFindersPerSide;
	double m_lfAngleStep;
public:
	RangeFinderArray(void);
	~RangeFinderArray(void);

	void SetParams(double lfLength, double lfWidth, double lfAngleStep, int nNumPerSide);

	void SetXformedParams(const Pos2d p2BackPoint, const Pos2d p2Dir, const Pos2d p2PerpDir);

	void ResetRanges(double lfMaxRange);

	void CollideConvexPoly(const double arrP2PolyBoundary[][2], int nNumPts);

	inline const Pos2d * GetPositionArr() const { return m_arrXformedPos; }
	inline const Pos2d * GetDirectionArr() const { return m_arrXformedDir; }
	inline const double * GetRangeArr() const { return m_arrLfRanges; }
	inline int GetNumRays() const { return m_nNumRangeFinders; }
	inline double GetAngleStep() const { return m_lfAngleStep; }
};
